/* pfs32PreChunk.cpp
 *
 * --
 * Copyright (c) 2012, Christophe Huriaux
 * Distributed under the terms of the MIT license.
 * http://www.opensource.org/licenses/mit-license.php
 * --
 */

#include <packet/pfs32PreChunk.h>
#include <wrapper/JavaStreamWrapper.h>

pfs32PreChunk::pfs32PreChunk()
    : McPacketFromServer(0x32), x(0), z(0), mode(false)
{
}

unsigned int pfs32PreChunk::length()
{
    return 1 + 4 + 4 + 1;
}

int16_t pfs32PreChunk::setField(uint8_t field, void* value)
{

    switch (field)
    {
        case 0:
        default: return 4;
        case 1: x = JavaStreamWrapper::readInt(value); return 4;
        case 2: z = JavaStreamWrapper::readInt(value); return 1;
        case 3: mode = JavaStreamWrapper::readBoolean(value); return -1;
    }
}

int32_t pfs32PreChunk::getX()
{
    return x;
}

int32_t pfs32PreChunk::getZ()
{
    return z;
}

bool pfs32PreChunk::getMode()
{
    return mode;
}


